package se.liu.johfa428.game.objects.levelselection;

import java.awt.Color;

import se.liu.oschi129.animation.Animation;
import se.liu.oschi129.animation.animationspace.AnimationSpace;
import se.liu.oschi129.font.fontspace.FontSpace;
import se.liu.oschi129.game.animationspace.GameAnimationSpace;
import se.liu.oschi129.world.model.World;
import se.liu.oschi129.world.model.WorldGraphics;
import se.liu.oschi129.world.objects.WorldStaticObject;

/**
 * The panel showing number of lives and score in the level selection menu.
 * @author johfa428
 *
 */

public class ObjectLevelSelectionStatusPanel extends WorldStaticObject{

	private Animation lives, coins;
	private World world;

	public ObjectLevelSelectionStatusPanel(World world) {
		super(Type.SOFT, AnimationSpace.get("img_status_bar01"), true, 0, world.getHeight()-38, 200, 65/2);
		// Draw topmost
		setDepth(-100);
		setVisible(true);
		this.world = world;
		lives = GameAnimationSpace.get("img_status_lives01");
		coins = GameAnimationSpace.get("img_status_coins01");
	}
	
	@Override public void performDrawingAction(WorldGraphics worldg) {
		super.performDrawingAction(worldg);
		worldg.drawAnimation(getX()+ 160, getY() + 17, 10, 10, coins);
		worldg.drawAnimation(getX()+12, getY() + 17, 25, 10, lives);
		
		worldg.setColor(Color.WHITE);
		worldg.setFont(FontSpace.get("font_status", 8f));

		worldg.drawText(170, getY()+ 25, String.format("%02d",world.getCoins()));
		worldg.drawText(38, getY() + 25, String.format("%02d",world.getLives()));
		worldg.drawText(80,getY() + 25, String.format("%07d",world.getPoints()));
		worldg.drawText(11, getY() + 13, "World 1");
		
	}
}
